// GE browser plugin object initCallback
function initGECallback(object) {
	// init google earth instance
	ge = object;
	ge.getWindow().setVisibility(true);
	ge.getLayerRoot().enableLayerById(ge.LAYER_BUILDINGS, false);
	ge.getLayerRoot().enableLayerById(ge.LAYER_BORDERS, true);
	ge.getLayerRoot().enableLayerById(ge.LAYER_ROADS, true);
	ge.getLayerRoot().enableLayerById(ge.LAYER_TERRAIN, false);

	ge.getNavigationControl().setVisibility(ge.VISIBILITY_AUTO);

	geInitialised = true;

	// addKMLOverlay(map, building2DKmlUrl);

	// loadAllBuildings();
}

// GE browser plugin object failure callback
function failureGECallback() {
	geInitialised = false;
	alert('Google earth loading failed. Please try to refresh the web map.');
}

function initGE(earthDiv) {
	google.earth.createInstance(earthDiv, initGECallback, failureGECallback);
}

function initGM() {
	// init google maps instance
	map = new GMap2(document.getElementById("map-container"));
	map.setCenter(new GLatLng(-37.817478, 144.963226), 16);
	map.addMapType(G_HYBRID_MAP);
	map.addControl(new GHierarchicalMapTypeControl());
	map.addControl(new GSmallMapControl());
	map.addControl(new GScaleControl());
	map.enableContinuousZoom();

	GEvent.addListener(map, "moveend", synchGE);

	gmInitialised = true;
}